'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: class_study.py
* @Time: 2025/6/22
* @All Rights Reserve By Brtc
'''
from calendar import month_abbr

# 类的学习
# 类的组成
# 1、 成员变量
# 2、 成员方法
# 定义格式
""""
class  类名(继承的类):# 可继承其他类 也可以不继承
    m_var:str= "" 成员变量
    def __init__() 构造函数
    def func()  成员函数
"""
class Dog:
    m_name: str = ""
    m_color:str =""
    m_age: int = 0
    def __init__(self,name,color,age):
        print(f"我是一条狗我的名字叫{name}, 我的毛发是{color}, 现在我已经{age}个月了, 我的对象正在被创建中")
        self.m_name = name
        self.m_color = color
        self.m_age = age


    def eat(self, food = ""):
        print(f"我正在吃饭我吃的是{food}")

    def group_up(self):
        self.m_age +=1


    def speak_out(self):
        print(f"汪汪， {self.m_name}, 我的毛发是{self.m_color}, 现在我已经{self.m_age}个月了")


    def print_self(self):
        print(id(self))



#test_dog = Dog("旺财", "黑色", 3)
#test_dog2 = Dog("小白", "白色", 5)
# 类的常规操作
"""
test_dog.eat("狗粮")
test_dog.group_up()
test_dog.speak_out()
test_dog2 = Dog("狗子", "黄色", 7)
test_dog2.eat("火腿肠")
test_dog2.group_up()
test_dog2.speak_out()
"""
# self 是什么？
# self 是 构建的 对象本身
#print(id(test_dog2))
#test_dog2.print_self()

#print(id(test_dog))
##test_dog.print_self()
# 子类会继承 父类所有的特性
#
# 类的继承
class Hashiqi(Dog):
    store:str=""
    def __init__(self, name, color, age, store):
        super().__init__(name, color, age)
        self.store = store

    def where_by(self):
        print(f"我是在哪里购买的{self.store}")
test_h = Hashiqi("小哈", "白色", 7, "楼下宠物店")
test_h.eat("火腿肠")
test_h.group_up()
test_h.speak_out()
test_h.where_by()